javax.realtime.DSS
Class PreemptableResource

java.lang.Object
  extended byjavax.realtime.DSS.Resource
      extended byjavax.realtime.DSS.PreemptableResource

public class PreemptableResource
extends Resource

A Resource modeling a resource that can be preempted.


Field Summary
 
Fields inherited from class javax.realtime.DSS.Resource
busyTimeThusFar, count, creationTime, holderThread, lastGrant, lastRelease, name, signalPriorityInversion, waiters
 
Constructor Summary
PreemptableResource(java.lang.String name)
           
PreemptableResource(java.lang.String name, boolean signalPriorityInversion)
          Constructor
 
Method Summary
 void adjustPriority(RealtimeThread thread)
          Adjust the priority of this RealtimeThread, according to resources currently held.
 void release()
          Release this PreemptableResource.
 void seize()
          Seize this Preemptableresource.
 
Methods inherited from class javax.realtime.DSS.Resource
dutyCycle, finalize, getExtent, giveResourceTo, maxWaiterPriority, printAllStatistics, printStatistics, releaseIfHeld, seize, seizeIfNotHeld, setExtent, toString, waiterIterator
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PreemptableResource

public PreemptableResource(java.lang.String name,
                           boolean signalPriorityInversion)
Constructor

Parameters:
name - The name of this

PreemptableResource

public PreemptableResource(java.lang.String name)
Method Detail

seize

public void seize()
           throws java.lang.InterruptedException,
                  ThreadTerminatedException
Seize this Preemptableresource. An internal loop is required to deal with the case where the resource was stolen between the time it was awarded by a releasing thread and the invoking thread starts to run.

Specified by:
seize in class Resource
Throws:
java.lang.InterruptedException
ThreadTerminatedException

release

public void release()
             throws ThreadTerminatedException
Release this PreemptableResource. May involve passing it on to a waiting thread.

Specified by:
release in class Resource
Throws:
ThreadTerminatedException

adjustPriority

public void adjustPriority(RealtimeThread thread)
Description copied from class: Resource
Adjust the priority of this RealtimeThread, according to resources currently held.

Specified by:
adjustPriority in class Resource